Release 10.1A: OpenEdge Development:
Progress 4GL Handbook


Defining triggers

Skip down to the part of the code marked Control Triggers. Here you’ll find the trigger blocks you defined for the buttons. Before these button triggers, there are a couple of standard AppBuilder-generated triggers to capture window events. Take a look at the second window trigger block:

ON WINDOW-CLOSE OF CustWin /* Customers and Orders */ 
DO: 
  /* This event will close the window and terminate the procedure.  */ 
  APPLY "CLOSE":U TO THIS-PROCEDURE. 
  RETURN NO-APPLY. 
END. 

Note: The :U tag that follows the quoted string tells the compiler to leave this string out of its list of strings that might be sensible to translate into other human languages. Since the word CLOSE is just part of the program logic and not something a user would ever see or want to see in a different language, it should never be translated.

WINDOW-CLOSE is one of those events like the CHOOSE event for a button. Remember that each type of object has its own set of events it can capture. WINDOW-CLOSE, logically enough, is the event that a window receives when it is closed, for example, by clicking the standard close-window box in the corner of the window.

The code then cascades this event down to the running procedure itself, by applying the CLOSE event to the procedure. There’s a special built-in function that always holds the handle of the currently running procedure: THIS-PROCEDURE. The APPLY statement makes an event happen just as a user action would. The event in this case is the CLOSE event for the procedure. Keep this in your mind for a few moments, and you’ll soon see what the CLOSE event does.

The RETURN NO-APPLY statement just means: “Skip whatever action was in the queue of user interface actions, because we’re getting out anyway.”

The button triggers

Next come the four button triggers you defined yourself. Just look at the first of them to confirm the syntax of the ON statement:

ON CHOOSE OF BtnFirst IN FRAME CustQuery /* First */ 
DO: 
  GET FIRST CustQuery. 
  IF AVAILABLE Customer THEN  
    DISPLAY Customer.CustNum Customer.Name Customer.Address Customer.City  
          Customer.State  
      WITH FRAME CustQuery IN WINDOW CustWin. 
  {&OPEN-BROWSERS-IN-QUERY-CustQuery} 
END. 

When you define triggers in the Section Editor, it masks the syntax of the ON statement somewhat by putting the event name and the object name into fill-ins that you can select. It also automatically adds the IN FRAME qualifier for you, based on which frame contains the object.


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095